import {Controller, Get, UseGuards, Query} from "@nestjs/common";
import {AccountGuard, AccountGuard2} from './guards/account.guard'
import {Roles,Roles2} from './decorator/roles.decorator';

@Controller('account')
// @UseGuards(AccountGuard)    //控制器级别
export class AccountController {
    @Get('index')
    // @UseGuards(AccountGuard)    //方法级别
    @Roles(`admin`, 'sell')
    async getIndex(@Query('role') role: string) {
        return 'account-index'
    }

    @Get('home')
    // @UseGuards(AccountGuard2)    //方法级别
    @Roles2([`admin`, 'sell'])
    async getHome(@Query('role') role: string) {
        return 'account-home '+role
    }
}
